﻿#pragma once
#include "GameplayAbilities/Public/AttributeSet.h"
#include "GameplayAbilities/Public/AbilitySystemComponent.h"
#include "TestAttributeSet.generated.h"

/**
* This defines a set of helper functions for accessing and initializing attributes, to avoid having to manually write these functions.
* It would creates the following functions, for attribute Health
*
*	static FGameplayAttribute UMyHealthSet::GetHealthAttribute();
*	FORCEINLINE float UMyHealthSet::GetHealth() const;
*	FORCEINLINE void UMyHealthSet::SetHealth(float NewVal);
*	FORCEINLINE void UMyHealthSet::InitHealth(float NewVal);
*
* To use this in your game you can define something like this, and then add game-specific functions as necessary:
* 
*	#define ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
*	GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
*	GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
*	GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
*	GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)
* 
*	ATTRIBUTE_ACCESSORS(UMyHealthSet, Health)
*/

#define ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)


UCLASS()
class TEST002_API UTestAttributeSet : public UAttributeSet
{
	GENERATED_BODY()
public:
	UTestAttributeSet();
protected:
	UPROPERTY()
	FGameplayAttributeData Health;
	ATTRIBUTE_ACCESSORS(UTestAttributeSet, Health)

	UPROPERTY()
	FGameplayAttributeData MaxHealth;
	ATTRIBUTE_ACCESSORS(UTestAttributeSet, MaxHealth)

	UFUNCTION(BlueprintCallable, Category = "TestAttributeSet", meta = (DisplayName = "GetHealth"))
	float BP_GetHealth() const;

	UPROPERTY()
	EJobType MainJobType;

	UPROPERTY()
	EJobType SubJobType;

	UPROPERTY()
	bool IsBlessed;

	UPROPERTY()
	ECampType CampType;
};
